package com.xcdh.test.mapper;

import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xcdh.test.entity.One;
import com.xcdh.test.provider.OneProvider;
import com.xcdh.test.vo.RowDetail;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface OneMapper extends BaseMapper<One> {

    @SelectProvider(type = OneProvider.class, method = "queryById")
    @Results({
            @Result(property = "child", javaType = List.class, column = "detail_id" ,
                    many = @Many(select = "com.xcdh.test.mapper.ManyMapper.selectByOneId"))
    })
    public RowDetail selectOneId(@Param("one") One one);

    @SelectProvider(type = OneProvider.class, method = "findChild")
    public List<JSONObject> selectChild(Integer id);
}
